1. Field of the Invention
This invention is related to the field of digital systems and, more particularly, to maintaining cache coherency in such systems.
2. Description of the Related Art
A bus is frequently used in digital systems to interconnect a variety of devices included in the digital system. Generally, one or more devices are connected to the bus, and use the bus to communicate with other devices connected to the bus. As used herein, the term xe2x80x9cagentxe2x80x9d refers to a device which is capable of communicating on the bus. The agent may be a requesting agent if the agent is capable of initiating transactions on the bus and may be a responding agent if the agent is capable of responding to a transaction initiated by a requesting agent. A given agent may be capable of being both a requesting agent and a responding agent. Additionally, a xe2x80x9ctransactionxe2x80x9d is a communication on the bus. The transaction may include an address transfer and optionally a data transfer. Transactions may be read transactions (transfers of data from the responding agent to the requesting agent) and write transactions (transfers of data from the requesting agent to the responding agent). Transactions may further include various coherency commands which may or may not involve a transfer of data.
A feature of many buses is a coherency protocol. The protocol is used by agents to ensure that transactions are performed in a coherent manner. More particularly, the coherency protocol is used, when one or more agents may cache data corresponding to a memory location, to ensure that cached copies and the memory location are updated to reflect the effect of various transactions which may be performed by various agents.
In some cases, coherency may be maintained via a snooping process in which each agent which may cache data may search its caches for a copy of the data affected by the transaction, as well as the state that the copy is in. As used herein, the xe2x80x9cstatexe2x80x9d of a cached copy of data may indicate a level of ownership of the data by the caching agent. The level of ownership indicates what operations are permissible on the cached copy. For example, a read of the cached copy may generally be permissible with any level of ownership other than no ownership (i.e. no cached copy is stored). A write may be permissible for levels of ownership which indicate that no other cached copies exist. An exemplary set of states may be the Modified, Exclusive, Shared, and Invalid (MESI) states or the MOESI states (including the MESI states and an owned state). Caching agents may report, using the coherency protocol, the state of the data within that agent. Based on the states reported using the coherency protocol, each agent may determine the action to take to update its state for the data being accessed by the transaction.
It is desirable for the state of the cached copy to be reported as soon as possible. Delayed reporting of the state may result in increased latency for the transaction. Furthermore, the amount of delay from initiating the transaction to reporting the state of the data affected by the transaction may make the coherency mechanism more complex. Unfortunately, it may be difficult to determine the exact state of the data quickly. Furthermore, to determine the exact state of the data may require intrusive changes to caches within the agent and/or to circuitry that interfaces with the caches.
The problems outlined above are in large part solved by a system as described herein. The system may include two or more agents, at least some of which may cache data. In response to a transaction, a caching agent may snoop its cached data and provide a response in a response phase of the transaction. Particularly, the response may include an exclusive indication used to represent both exclusive and modified states within that agent. In one embodiment, the agent responding exclusive may be responsible for providing the data for a read transaction, and may transmit an indication of which of the exclusive or modified state that agent had the data in concurrent with transmitting the data. Thus, the caching agents may defer determining which of the exclusive state or the modified state that agent has the data in. Snooping hardware may be simplified, and may allow for a rapid snoop response.
In one embodiment, the bus on which transactions are transmitted is a split transaction bus in which the data bus is separately arbitrated for by the responding agent. In the case of an exclusive snoop hit for a read, the responding agent may be the agent that responded exclusive. Thus, the responding agent may control when the data is provided, and thus the agents may have flexibility in responding to exclusive snoop hits. This flexibility may be used to provide a relatively nonintrusive mechanism for fetching data and performing snoop updates within the agent.
In another embodiment of the system, the caching agent may provide a modified response in the response phase if the data is in the modified state at the time of the snoop (as well as an exclusive response if the data is in the exclusive state at the time of the snoop), but may provide the data for a read transaction if the response is either exclusive or modified. Such an implementation may allow for the caching agent to modify the data prior to providing the data, even if the data is in the exclusive state at the time of the snoop. The mechanism for fetching the data within the agent may be made relatively nonintrusive. For example, the mechanism may not block in-flight stores from modifying exclusive data before the data is fetched from the data cache (and the state changed in the data cache), even if a response of exclusive has already been given for the transaction. The caching agent may indicate that the data is modified when providing the data, if the data was modified between the snoop and the transmission of the data.
Broadly speaking, a system is contemplated. The system comprises a first agent configured to transmit an address of a transaction, and a second agent coupled to receive the address. The second agent is configured to transmit an indication of a state, within the second agent, of data corresponding to the address. The indication indicates an exclusive state for both the exclusive state and a modified state of the data within the second agent.
Additionally, a second system is contemplated comprising a first agent configured to transmit an address of a read transaction, and a second agent coupled to receive the address. The second agent is configured to provide data corresponding to the address to the first agent responsive to the second agent having the data in an exclusive state.
Moreover, an agent is contemplated. The agent comprises a storage configured to store state information indicative of a state of data stored within the agent, and a circuit coupled to the storage and to receive an address of a transaction. The circuit is configured to generate an indication of a state of data corresponding to the address responsive to the state information in the storage. The indication indicates an exclusive state for both an exclusive state within the agent and a modified state within the agent.
Still further, a second agent is contemplated. The agent includes a data cache configured to store data in a plurality of states including an exclusive state and a modified state, and a circuit coupled to the data cache. The circuit is configured to retrieve first data from the data cache and to provide the first data in response to a read transaction operating on the first data if the first data is in the exclusive state.
Furthermore, a method is contemplated. An address of a transaction is received in an agent. The agent responds during a response phase of the transaction with an exclusive state for both the exclusive state and a modified state of data corresponding to the address within the agent.
Additionally, another method is contemplated. An address of a read transaction is received in a agent. Data is transmitted from the agent for the transaction responsive to the agent having the data in an exclusive state.